package com.tech.consumer.fallback;

import com.tech.consumer.client.XxxFeignClient;
import com.tech.entity.SystemResult;
import com.tech.entity.user.User;
import org.springframework.stereotype.Component;

/**
 * XxxFeignClient的Fallback类
 */
@Component
public class XxxFeignClientFallback implements XxxFeignClient {

    @Override
    public SystemResult<User> getUserByParam(Integer id, String name) {
        SystemResult<User> result = new  SystemResult<User>();
        User user = new User();
        user.setId(-1);
        user.setName("默认错误");
        result.setT(user);
        return result;
    }

    @Override
    public SystemResult<User> getUser(User user) {
        SystemResult<User> result = new  SystemResult<User>();
        user.setId(-2);
        user.setName(String.format("错误：[%s, %s]", user.getId(), user.getName()));
        result.setT(user);
        return result;
    }
}
